home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / listings / v_13_07 / williams / tsrtdefs.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-02-23  |  2.2 KB  |  85 lines

  1. Listing 3: Header File for tstsort.c and Sort
  2.        Function Wannabes
  3. =============================================
  4.  
  5. /* ============ */
  6. /* tsrtdefs.h    */
  7. /* ============ */
  8. /* ============================================ */
  9. /* DEFINES & TYPEDEFS FOR SORT TESTING PROGRAM    */
  10. /* ============================================ */
  11. # if defined(__TSRTDEFS_H)
  12. # else
  13. #    define __TSRTDEFS_H
  14. #
  15. #define    DQ(name)    ST(##name)
  16. #define ST(name)    #name
  17.  
  18. #define    PRTIM        'P'    /* Print Time  */
  19. #define NOTIM        'N'    /* Don't Print */
  20.  
  21. /*  ------------------------------  */
  22. /*  Sort Objects are designated as: */
  23. /*  ------------------------------  */
  24. /*  R   Random                */
  25. /*  S   Already Sorted            */
  26. /*  V   Reverse Sorted            */
  27. /*  H   Reverse Sorted by Halves    */
  28. /*  F   First Item Out of Sort        */
  29. /*  T   Every Third Item Inverted   */
  30. /*  Q   All Items Equal            */
  31. /*  E   Every Eighth Item Different */
  32. /*  A   Alternating Pairs        */
  33. /*  B   Boresight Simulation        */
  34. /*  ------------------------------  */
  35.  
  36. static    char    SortCodes[] = "RSVHFTQEAB";
  37.  
  38. #define    RANDOM        0
  39. #define    ALRDY_SRTD    1
  40. #define    RVRS_SRTD       2
  41. #define    RVRS_HLVS       3
  42. #define    FRST_OUT    4
  43. #define    THRD_INV    5
  44. #define    ALL_SAME    6
  45. #define    EVRY_8TH    7
  46. #define    ALT_PAIRS    8
  47. #define    BORST_SIM    9
  48.  
  49. #define    WANT(OptionList, OptNum)    \
  50.     (OptionList &            \
  51.     (1 << ((sizeof(SortCodes) - 2) - OptNum)))
  52.  
  53. typedef    int    CMPR_FUN(const void *, const void *);
  54. typedef    void    SORT_FUN(void *, size_t, size_t,
  55.                      CMPR_FUN *);
  56.  
  57. typedef    struct    SortTestStru
  58. {
  59.     int        argc;      /* No. Command-Line Args.  */
  60.     char     **argv;      /* Command-Line Arguments  */
  61.     SORT_FUN  *SortFun;      /* Entry Location of Sort  */
  62.     char      *OKCodes;      /* Sort Objects Permitted  */
  63.     char      *ExecName;  /* Name of Executable File */
  64.     char      *ExecLabel; /* Short Descriptive Label */
  65. }
  66.     SORT_TEST_STRU;
  67.  
  68. /* ------------------- */
  69. /* FUNCTION PROTOTYPES */
  70. /* ------------------- */
  71. # undef F
  72. # if defined(__STDC__) || defined(__PROTO__)
  73. #    define    F( P )    P
  74. # else
  75. #    define    F( P )    ()
  76. # endif
  77. /* INDENT OFF */
  78.  
  79. extern    void    tstsort F((SORT_TEST_STRU *));
  80.  
  81. # undef F
  82. /* INDENT ON */
  83.  
  84. # endif        /* <<< __TSRTDEFS_H >> */
  85.